import router from "@/router"
import { routerStore } from '@/stores/routerStore/routerStore'
const store = routerStore()
router.beforeEach((to) => {
    document.title = String(to.meta.title)
})
router.afterEach((to, from) => {
    /**
     * 动态缓存路由设置
    */
    let obj
    if (to.name) {
        obj = store.cahceList.find(item => {
            return item === to.name
        })
        if (!obj) {
            store.addCacheList(String(to.name))
        } else if (!from.meta.tabbar) {
            //['home','my','orderList','worker'] 为tabbar页面
            store.deleteCacheList()
        }
    }
})